package goals;

import world.Person;
import world.PhysicalObject;
import control.GUI.Output;

public class GoalAttack extends Goal {

	protected PhysicalObject target;

	public PhysicalObject getTarget() {
		return target;
	}

	public GoalAttack(Person self, PhysicalObject target) {
		super(self, 90);
		this.target = target;
	}

	@Override
	public boolean act(Output out) {
		moveTowards(target);
		if (this.timeLeft > 0) {
			attack(target, out);
			return true;
		} else {
			return false;
		}
	}

	@Override
	public String toString() {
		return "attack " + target.getName();
	}

	@Override
	public int getReevaluationTimeSpan() {
		return 5;
	}
	
}
